<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <canvas width="512" height="512"></canvas>
  <script src="/js/mesh.js"></script>
  <script>
    const {Renderer, Figure2D, Mesh2D} = meshjs;

    const canvas = document.querySelector('canvas');
    const renderer = new Renderer(canvas, {
      // contextType: '2d',
    });

    const figure = new Figure2D();
    figure.beginPath();
    figure.moveTo(0, 87.8542335707851);
    figure.lineTo(19.761904761904763, 67.77716403973452);
    figure.lineTo(15.336778571931756, 66.68540867059392);

    // 0,
    // 87.8542335707851,
    // 19.761904761904763,
    // 67.77716403973452,

    const mesh = new Mesh2D(figure);
    mesh.setStroke({
      color: [0, 0, 1, 0.3],
      thickness: 20,
      cap: 'round',
      // miterLimit: 6,
      // join: 'round',
      join: 'round',
    });

    mesh.translate(100, 100);

    const mesh2 = new Mesh2D(figure, canvas);
    mesh2.setStroke({
      color: [1, 0, 0, 1],
      thickness: 1,
    });
    mesh2.translate(100, 100);

    renderer.drawMeshes([mesh]);
    renderer.drawMeshes([mesh2]);
  </script>
</body>
</html>